import formBuilder from "@/comps/form/formBuilder";
import api from "./api";
import apiCheckProcess from "@/pages/v1/mes/CheckProcess/js/apiCheckProcess";
import apiCheckResultGroup from "@/pages/v1/mes/CheckResultGroup/js/apiCheckResultGroup";
/*
fb.addText("name","检出原因",3)
fb.addText("process","所属检验工序",3)
fb.addText("code","编码",3)

* */
export default {
    main:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)
        fb.addText("name","检出原因",3)
        fb.addSelect("processId","所属检验工序",3).setApi(apiCheckProcess.urlChoice)
        fb.addSelect("groupId","检出分组",3).setApi(apiCheckResultGroup.urlChoice)
        fb.addText("code","编码",3)

        return fb
    },
    tree:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addCascade("parentId").setLabel("上级分类").setSpan(3)
            .setApi(api.urlTree)

        fb.addText("name").setSpan(6).setLabel("分类名称")
            .setRules([fb.R.notNull("名称不能为空")])

        fb.addText("sort").setSpan(3).setLabel("排序").setTypeNumber()
        return fb
    },
    other:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        return fb
    }
}